package com.caozhi.mspeoject.nb_message.controller.admin;

import com.caozhi.mspeoject.nb_message.bean.Article;
import com.caozhi.mspeoject.nb_message.service.admin.ArticleService;
import com.woniuxy.boot.common.pojo.ResponseResult;
import org.elasticsearch.common.recycler.Recycler;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("admin/article")
public class ArticleController {
    @Autowired
    private ArticleService articleService;
    @GetMapping("getArticleById")
    public ResponseResult<Article> getArticleById(@RequestParam("id") Long id) {
        return new ResponseResult<>( articleService.findArticleById(id));
    }
    @PostMapping("add")
    public ResponseResult<Void> addArticle(@RequestBody Article article) {
        articleService.addArticle(article);
        return ResponseResult.SUCCESS;
    }
}
